#ifndef PLAYLISTLISTMODEL_H
#define PLAYLISTLISTMODEL_H

#include <QAbstractListModel>
#include <QFileInfo>

/** A list model for a choice of playlists or music folders.
    Restored persistently from/to QSettings.
    Shown in ParentListView.qml.
    
    @author Alan Ezust
*/
class PlayListListModel : public QAbstractListModel {
    Q_OBJECT
public:
    enum Roles {
        NameRole = Qt::UserRole + 1,
        PathRole };
    explicit PlayListListModel(QObject *parent = 0);
    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    int rowCount(const QModelIndex &parent = QModelIndex()) const;    
    bool removeRows(int row, int count, const QModelIndex &parent);

public slots:
    void restoreFromSettings();
    void clear();
    int indexOf(QString path) const;
    void addSongDirectory(QString path);
    void addM3uDirectory(QString path);
    void scanForPlaylists(QString m3uDir);
    void scanForSongDirs(QString songDir);
    void closePlaylist(QString path);

private:

    QList<QFileInfo> m_playlists;
};

#endif // PLAYLISTLISTMODEL_H
